package 二叉树相关问题.BST;

public class 最小高度树 {

    public TreeNode sortedArrayToBST(int[] nums) {
       return traverse(nums,0,nums.length);
    }

    private TreeNode traverse(int[] nums, int left, int right) {
        if (left==right)
            return null;
        int mid=left+(right-left)/2;
        TreeNode root = new TreeNode(nums[mid]);
        root.left=traverse(nums,left,mid);
        root.right=traverse(nums,mid+1,right);
        return root;
    }

}
